/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package asfabdesk.dominio;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
 *
 * @author marco.machado
 */
@Entity
@NamedQueries(value = {
    @NamedQuery(name = "ItensPorSaida", query = "SELECT i FROM ItemSaida i WHERE saida =? ")

})
@Table(name = "ITENS_SAIDA")
public class ItemSaida implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String descricao; //descricao do ítem
    private double valorIten; // (R$)
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dataVencimento;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dataPgt;
    @JoinColumn(name = "CENTRO_CUSTO", referencedColumnName = "id")
    @ManyToOne
    private CentroDeCusto centroCusto;
    @JoinColumn(name = "SAIDA", referencedColumnName = "id")
    @ManyToOne
    private SaidaFinanceira saida;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public double getValorIten() {
        return valorIten;
    }

    public void setValorIten(double valorIten) {
        this.valorIten = valorIten;
    }

    public Date getDataPgt() {
        return dataPgt;
    }

    public void setDataPgt(Date dataPgt) {
        this.dataPgt = dataPgt;
    }

    public Date getDataVencimento() {
        return dataVencimento;
    }

    public void setDataVencimento(Date dataVencimento) {
        this.dataVencimento = dataVencimento;
    }

    public CentroDeCusto getCentroCusto() {
        return centroCusto;
    }

    public void setCentroCusto(CentroDeCusto centroCusto) {
        this.centroCusto = centroCusto;
    }

    public SaidaFinanceira getSaida() {
        return saida;
    }

    public void setSaida(SaidaFinanceira saida) {
        this.saida = saida;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemSaida)) {
            return false;
        }
        ItemSaida other = (ItemSaida) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "asfabdesk.dominio.ItenSaida[id=" + id + "]";
    }
}
